<template>
  <div class="user-index">
    <div class="user-info">
      <div class="user-avatar">
        <img src="@/assets/home/uy-1.png" alt="" />
      </div>
      <div class="user-name">
        <div class="u-1">{{ store?.user.realName }}</div>
        <div class="u-2">学在农林已陪您365天了</div>
      </div>
    </div>
    <div class="user-menu">
      <div class="menu-1">
        <CpRadioBtn title="最近使用" @cadd="zjadd"></CpRadioBtn>
        <div class="icon-1">
          <div class="home-1-co4" v-for="(item, index) in arr" :key="index">
            <img :src="item.img" class="imgs-1" />
            <div class="home-1-co5">{{ item.name }}</div>
          </div>
        </div>
      </div>
      <!-- 学习记录 -->
      <div class="xue-1">
        <CpRadioBtn title="学习记录" @cadd="xjadd"></CpRadioBtn>
        <record></record>
      </div>
      <div class="ying-1">
        <van-cell
          v-for="(item, index) in tools"
          :key="index"
          :title="item.label"
          is-link
          :to="item.path"
          :border="false"
        >
          <template #icon><img :src='item.imgs' /></template>
        </van-cell>
      </div>
    </div>
  </div>
</template>

<script>
import z1 from '@/assets/home/ic_zxt.png'
import z2 from '@/assets/home/ic_zlqn.png'
import z3 from '@/assets/home/ic_rczp.png'
import z4 from '@/assets/home/ic_yslndx.png'
import f1 from '@/assets/user/f.png'
import c1 from '@/assets/user/c.png'
import zx1 from '@/assets/user/z.png'
import record from './components/record.vue'
import { mapState } from 'vuex'
import CpRadioBtn from '@/components/CpRadioBtn.vue'

export default {

  components: {
    record,
    CpRadioBtn
  },
  data () {
    return {
      arr: [
        { name: '浙学通', img: z1 },
        { name: '浙里青年', img: z2 },
        { name: '人才招聘', img: z3 },
        { name: '云上老年大学', img: z4 }
      ],
      tools: [
        { label: '访问记录', path: '/', imgs: f1 },
        { label: '操作指南', path: '/Picture', imgs: c1 },
        { label: '咨询记录', path: '/', imgs: zx1 }
      ]
    }
  },
  computed: {
    ...mapState({
      store: state => state.user.user,
    })
  },
  methods: {
    zjadd () {
      this.$router.push('/notify')
    },
    xjadd () {
      console.log('====================================')
      console.log(2222, '学习记录')
      console.log('====================================')
    }
  }
}
</script>

<style lang="scss" scoped>
.user-index {
  padding-bottom: 57px;
  width: 100%;
  height: 100%;
  background: #f7f7f7;
  box-sizing: border-box;
}
.user-info {
  width: 100%;
  height: 120px;
  background-image: url('@/assets/user/bg.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 18px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
.user-avatar {
  width: 50px;
  height: 50px;
  img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid #fff;
  }
}
.user-name {
  margin-left: 18px;
}
.u-1 {
  font-weight: 500;
  font-size: 19px;
  color: #333333;
  margin-bottom: 4px;
}
.u-2 {
  font-weight: 400;
  font-size: 15px;
  color: #777777;
}
.user-menu {
  width: 100%;
  padding: 0 11px;
  box-sizing: border-box;
}
.menu-1 {
  width: 100%;
  height: 130px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  padding: 11px;
  box-sizing: border-box;
}
.img-1 {
  width: 22px;
  height: 22px;
  margin-top: -3px;
}
.icon-1 {
  width: 100%;
  height: 70px;
  display: flex;
}
.home-1-co4 {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-1-co5 {
  width: 100%;
  text-align: center;
  font-weight: 400;
  font-size: 13px;
  color: #333333;
}
.imgs-1 {
  width: 40px;
  height: 40px;
}
.xue-1 {
  width: 100%;
  height: 202px;
  background: #ffffff;
  border-radius: 8px;
  margin-top: 11px;
  border: 1px solid #e5e5e5;
  padding: 11px;
  box-sizing: border-box;
}
.ying-1 {
  width: 100%;
  height: 160px;
  background: #ffffff;
  border-radius: 8px;
  margin-top: 21px;
}
.van-cell {
  align-items: center;
}
.van-cell {
  img{    
    margin-right: 10px;
  }
 
}
</style>
